package com.software.graduationproject.modules.shopping.entity;

import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.v2coding.mybatis.model.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;

/**
 * ShoppingCart : 购物车表
 * ---------------------------------------------------------------------------------------------------------------------
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("shopping_cart")
@ApiModel(value = "ShoppingCart", description = "购物车表")
public class ShoppingCart extends BaseModel<ShoppingCart> {

    @TableField(value ="user_id")
    @ExcelProperty(value = "用户ID")
    @ApiModelProperty(value = "用户ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户ID不能为空")
    private Long userId;

    @TableField(value ="marketers_id")
    @ExcelProperty(value = "商家ID")
    @ApiModelProperty(value = "商家ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "商家ID不能为空")
    private Long marketersId;

    @TableField(value ="food_id")
    @ExcelProperty(value = "食品ID")
    @ApiModelProperty(value = "食品ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "食品ID不能为空")
    private Long foodId;

    @TableField(value ="quantity")
    @ExcelProperty(value = "购买数量")
    @ApiModelProperty(value = "购买数量")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "购买数量不能为空")
    private Integer quantity;

    @TableField(value ="price")
    @ExcelProperty(value = "价格")
    @ApiModelProperty(value = "价格")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "价格不能为空")
    private Double price;

    @TableField(value ="original_price")
    @ExcelProperty(value = "原价")
    @ApiModelProperty(value = "原价")
    private Double originalPrice;

    @TableField(value ="unit_price")
    @ExcelProperty(value = "单价")
    @ApiModelProperty(value = "单价")
    private Double unitPrice;

    @TableField(value ="discount")
    @ExcelProperty(value = "折扣")
    @ApiModelProperty(value = "折扣")
    private Float discount;

    @TableField(value ="taste")
    @ExcelProperty(value = "口味")
    @ApiModelProperty(value = "口味")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "口味长度不能超过255")
    private String taste;

    @TableField(value ="status")
    @ExcelProperty(value = "结算状态（0：未结算 1：已结算）")
    @ApiModelProperty(value = "结算状态（0：未结算 1：已结算）")
    private Integer status;

}
